package com.supermap.localization.impl;

import org.apache.log4j.Logger;

import com.supermap.localization.api.LocalizationOperation;
import com.supermap.localization.api.SampleComponent;
import com.supermap.localization.util.ConfigsUtil;

public class LocalizationImport implements LocalizationOperation {

    private static Logger logger = Logger.getLogger(LocalizationImport.class);

    private SampleComponent dbSampleComp;

    private SampleComponent propSampleComp;

    public void setDbSampleComp(SampleComponent dbSampleComp) {
        this.dbSampleComp = dbSampleComp;
    }

    public void setPropSampleComp(SampleComponent propSampleComp) {
        this.propSampleComp = propSampleComp;
    }

    @Override
    public void execute() {
        dbSampleComp.saveSampleTranslate(propSampleComp.readSampleTranslate(ConfigsUtil.replaceConfig.getTranslateFilePath()));
        System.out.println("文件：" + ConfigsUtil.replaceConfig.getTranslateFilePath() + "导入成功！");
        logger.info("文件：" + ConfigsUtil.replaceConfig.getTranslateFilePath() + "导入成功！");
    }

}
